'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH REGCMP 1 "Dec 20, 1996"
.SH NAME
regcmp \- regular expression compile
.SH SYNOPSIS
.LP
.nf
\fBregcmp\fR [\fB-\fR] \fIfilename\fR...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBregcmp\fR command performs a function similar to \fBregcmp\fR and, in
most cases, precludes the need for calling \fBregcmp\fR from C programs.
Bypassing \fBregcmp\fR saves on both execution time and program size. The
command \fBregcmp\fR compiles the regular expressions in \fIfilename\fR and
places the output in \fIfilename\fR\fB\&.i\fR.
.SH OPTIONS
.sp
.ne 2
.na
\fB\fB\(mi\fR \fR
.ad
.RS 9n
If the \fB\(mi\fR option is used, the output is placed in
\fIfilename\fR\fB\&.c\fR. The format of entries in \fIfilename\fR is a name (C
variable) followed by one or more blanks followed by one or more regular
expressions enclosed in double quotes. The output of \fBregcmp\fR is C source
code. Compiled regular expressions are represented as \fBextern char\fR
vectors. \fIfilename\fR\fB\&.i\fR files may thus be \fB#include\fRd in C
programs, or \fIfilename\fR\fB\&.c\fR files may be compiled and later loaded.
In the C program that uses the \fBregcmp\fR output, \fBregex(abc,line)\fR
applies the regular expression named \fBabc\fR to \fBline\fR. Diagnostics are
self-explanatory.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRExamples of the \fBregcmp\fR command.
.sp
.ne 2
.na
\fBname \fR
.ad
.RS 9n
\fB"([A\(miZa\(miz][A\(miZa\(miz0\(mi9_]*)$0"\fR
.RE

.sp
.ne 2
.na
\fBtelno\fR
.ad
.RS 9n
\fB"\|\e({0,1}([2\(mi9][01][1\(mi9])$0\e){0,1} *"\fR
.sp
\fB"([2\(mi9][0\(mi9]{2})$1[ \(mi]{0,1}"\fR
.sp
\fB"([0\(mi9]{4})$2"\fR
.RE

.sp
.LP
The three arguments to \fBtelno\fR shown above must all be entered on one line.

.sp
.LP
In the C program that uses the \fBregcmp\fR output,

.sp
.in +2
.nf
     regex(telno, line, area, exch, rest)
.fi
.in -2
.sp

.sp
.LP
applies the regular expression named \fBtelno\fR to \fBline\fR.

.SH ENVIRONMENT VARIABLES
.sp
.LP
A general description of the usage of the \fBLC_*\fR environmental variables
can be found in \fBenviron\fR(7).
.sp
.ne 2
.na
\fB\fBLC_CTYPE\fR \fR
.ad
.RS 16n
Determines how \fBregcmp\fR handles characters. When \fBLC_CTYPE\fR is set to a
valid value, \fBregcmp\fR can display and handle text and filenames containing
valid characters for that locale.
.RE

.sp
.ne 2
.na
\fB\fBLC_MESSAGES\fR \fR
.ad
.RS 16n
Determines how diagnostic and informative messages are presented. This includes
the language and style of the messages, and the correct form of affirmative and
negative responses.  In the "C" locale, the messages are presented in the
default form found in the program itself (in most cases, U.S. English).
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
CSI	Enabled
.TE

.SH SEE ALSO
.sp
.LP
.BR regcmp (3C),
.BR attributes (7),
.BR environ (7)
